//
//  CatTypeUtils.m
//  CarTown
//
//  Created by xionghao on 15/9/5.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "CatTypeUtils.h"
#import "CatType.h"
@implementation CatTypeUtils
+(void)getCatType:(void (^)(bool))su{
    
   NSArray *array=[CatType getCatType];
    if (array.count>0) {
        if (su) {
            su(YES);
        }
        return;
    }else{
        NSMutableDictionary *params=[NSMutableDictionary dictionary];
        params[@"action"]=@"select";
        [PostUitls Post:catgoreyurl parameters:params success:^(id response) {
            NSLog(@"%@",response);
            NSArray *array=response;
            [CatType addCatType:array];
            if (su) {
                su(YES);
            }
            
        } failure:^(NSError *error) {
            if (su) {
                su(NO);
            }
            NSLog(@"%@",error);
        }];

    }
    
}
@end
